home *** CD-ROM | disk | FTP | other *** search
- Path: gwen.pcug.co.uk!altheim!broldham
- Newsgroups: comp.lang.c
- Message-ID: <1239@altheim.win-uk.net>
- Reply-To: broldham@altheim.win-uk.net (Brian R. Oldham)
- From: broldham@altheim.win-uk.net (Brian R. Oldham)
- Date: Mon, 18 Mar 1996 08:47:26 GMT
- Subject: Pointers to register
-
- A couple of weeks ago someone posted the opinion that all objects in
- memory must have an address, which might have gone uncontested but for
- the fact that he added that therefore all pointers must point to an
- address. Someone else reminded us that registers don't have an address.
-
- Bearing in mind the usual way to assign a pointer:
-
- ptr = &var;
-
- is correct for objects in memory, but how do you assign a pointer
- to a register?
-
- The following function (a getch() for x86) works: But is it right??
-
- /* Read next keystroke */
- #include <dos.h>
-
- #define KEYBD 0x16
-
- static union REGS inregs, outregs;
-
- void getkey(int *scancode, char *ch)
- {
- inregs.h.ah = 0x00;
- int86(KEYBD,&inregs,&outregs);
- *scancode = outregs.h.ah; /* ??? */
- *ch = outregs.h.al;
- }
-
-
- ---
- Brian Oldham
- Hucknall UK
- !...Gesundbrunnen
-
-
-
-
-
-
-
-
-